package com.janj.controller;

import com.janj.bean.Hero;
import com.janj.servier.HeroService;
import com.janj.servier.HeroServiceImpl;
import org.junit.Test;

import java.util.List;

public class HeroDemo {

 //查看
    @Test
    public void testSelecAll(){
        HeroService service = new HeroServiceImpl();
        List<Hero> array = service.selectAll();
        System.out.println("--------------");
        for (Hero hero : array) {
            System.out.println(hero);
        }
    }

  //修改
    @Test
  public void testUpdateHeroValue(){
        Hero h = new Hero();
        h.setId(1);
        h.setNice("及时雨");

        HeroService service = new HeroServiceImpl();
      Integer lineNumber = service.updateHeroValue(h);
      System.out.println("--------------");
      System.out.println("lineNumber = " + lineNumber);
      System.out.println(lineNumber>0?"成功":"失败");
    }

    //删除
     @Test
    public void testDeleteHeroValue(){
        Hero h = new Hero();
        h.setId(17);

        HeroService service = new HeroServiceImpl();
         Integer lineNumber = service.deleteHeroValue(h);
         System.out.println("-----------");
         System.out.println("lineNumber = " + lineNumber);
         System.out.println(lineNumber>0?"成功":"失败");
     }
}
